import { AntDesignOutlined, ContainerOutlined, DashboardOutlined, MenuOutlined, QrcodeOutlined, SlidersOutlined, UnorderedListOutlined, UserOutlined } from "@ant-design/icons";
import React from "react";
import { StopIcon, ServiceError, NotFoundIcon, ErrorPageIcon, ViteIcon, ReactIcon, DemoIcon, MapIcon, EchartsIcon, PersonIcon, HasPermissionIcon, NoPermissionIcon } from "@/components/icons";

// 同步引入组件 （keep-alive加载异步组件白屏）
import FrameWork from "@/pages/layout";
import Login from "@/pages/login";

import Dashboard from "@/pages/dashboard";
import Workbench from "@/pages/dashboard/workbench";
import Monitor from "@/pages/dashboard/monitor";

import Test from "@/pages/test";
import Test1 from "@/pages/test/test1";
import Test2 from "@/pages/test/test1/test2";
import Test2_1 from "@/pages/test/test1/test2/test2-1";
import Test3 from "@/pages/test/test3";
import TestDetail from "@/pages/test/test3/detail";

import List from "@/pages/list";
import NormalList from "@/pages/list/normal";
import CardsList from "@/pages/list/card";


import DocsPage from "@/pages/docs";
import IFrame from "@/pages/docs/iframe";

import Permession from "@/pages/permission";
import PermissionDemo from "@/pages/permission/permissiondemo";
import JustAdmin from "@/pages/permission/justAdmin";

import Errors from "@/pages/errors";

import UserCenter from "@/pages/userCenter";

import Demo from "@/pages/demo";
import Maps from "@/pages/demo/map";
import EchartsDemo from "@/pages/demo/echarts";
import QRCodeDemo from "@/pages/demo/qrcode";

interface routesProps {
    path: string,
    name: string,
    icon?: React.ReactNode,
    children?: routesProps[],
    element?: any,
    actived?: boolean,
    redirect?: boolean,
    isShow?: boolean,
    roles?: string[]
}

export const routes: routesProps[] = [
    {
        path: "/",
        name: "管理系统",
        element: FrameWork,
        children: [
            {
                path: "dashboard",
                name: "仪表盘",
                icon: <DashboardOutlined />,
                element: Dashboard,
                children: [
                    {
                        path: "workbench",
                        name: "工作台",
                        icon: <DashboardOutlined />,
                        element: Workbench,
                        actived: true,
                    }, {
                        path: "monitor",
                        name: "监控页",
                        icon: <SlidersOutlined />,
                        element: Monitor,
                        actived: true,
                    }
                ]
            }, {
                path: "test",
                name: "多级菜单demo",
                icon: <MenuOutlined />,
                element: Test,
                children: [
                    {
                        path: "test1",
                        name: "test1",
                        icon: <MenuOutlined />,
                        element: Test1,
                        children: [
                            {
                                path: "test2",
                                name: "test2",
                                icon: <MenuOutlined />,
                                element: Test2,
                                children: [
                                    {
                                        path: "test2_1",
                                        name: "test2_1",
                                        icon: <MenuOutlined />,
                                        element: Test2_1,
                                    },
                                ]
                            },
                        ]
                    },
                    {
                        path: "test3",
                        name: "test3",
                        icon: <MenuOutlined />,
                        element: Test3,
                    },
                    {
                        path: "detail",
                        name: "detail",
                        icon: <MenuOutlined />,
                        element: TestDetail,
                        isShow: false,
                    },
                ]
            }, {
                path: "list",
                name: "列表页",
                icon: <UnorderedListOutlined />,
                element: List,
                children: [
                    {
                        path: "normallist",
                        name: "普通列表",
                        icon: <UnorderedListOutlined />,
                        element: NormalList,
                    },
                    {
                        path: "cardlist",
                        name: "卡片列表",
                        icon: <UnorderedListOutlined />,
                        element: CardsList,
                    }
                ]
            }, {
                path: "demo",
                name: "功能示例",
                icon: <DemoIcon />,
                element: Demo,
                children: [
                    { path: "echarts", name: "echarts示例", icon: <EchartsIcon />, element: EchartsDemo },
                    { path: "map", name: "地图", icon: <MapIcon />, element: Maps, actived: true },
                    { path: "qrcode", name: "二维码", icon: <QrcodeOutlined />, element: QRCodeDemo },
                ]
            }, {
                path: "docx",
                name: "文档",
                icon: <ContainerOutlined />,
                element: DocsPage,
                children: [
                    {
                        path: "react",
                        name: "React",
                        icon: <ReactIcon />,
                        element: IFrame,
                    },
                    {
                        path: "vite",
                        name: "Vite",
                        icon: <ViteIcon />,
                        element: IFrame,
                    },
                    {
                        path: "antd",
                        name: "Antd",
                        icon: <AntDesignOutlined />,
                        element: IFrame,
                    }
                ]
            }, {
                path: "permission",
                name: "权限",
                icon: <PersonIcon />,
                element: Permession,
                children: [
                    { path: "permissiondemo", name: "权限示例", icon: <HasPermissionIcon />, element: PermissionDemo },
                    { path: "justadmin", name: "仅管理员可见", icon: <NoPermissionIcon />, element: JustAdmin, roles: ["admin"] },
                ]
            }, {
                path: "errors",
                name: "异常页面",
                element: Errors,
                icon: <ErrorPageIcon />,
                children: [
                    {
                        path: "500",
                        name: "500",
                        icon: <ServiceError />,
                        element: Errors,
                    },
                    {
                        path: "404",
                        name: "404",
                        icon: <NotFoundIcon />,
                        element: Errors,
                    },
                    {
                        path: "403",
                        name: "403",
                        icon: <StopIcon />,
                        element: Errors,
                    }
                ]
            }, {
                path: "userCenter",
                name: "个人中心",
                icon: <UserOutlined />,
                element: UserCenter,
                // actived: true,
            }
        ]
    },
    {
        path: "/login",
        name: "登录",
        element: Login,
    },
    {
        path: "*",
        name: "notFound",
        redirect: true
    },
    {
        path: "/notFound",
        name: "页面未找到",
        element: Errors,
    },
]

export type {
    routesProps
}

/**
 * 
 * 
 * ,
            {
                path: "user",
                name: "用户管理",
                icon: <UserOutlined />,
                element: User,
                children: [
                    {
                        path: "demo1",
                        name: "demo1",
                        element: Demo1,
                        actived: true,
                    },
                    {
                        path: "demo2",
                        name: "demo2",
                        element: Demo2,
                    },
                    {
                        path: "demo3",
                        name: "demo3",
                        element: Demo3,
                        actived: true,
                    },
                ]
            },
            {
                path: "order",
                name: "订单管理",
                icon: <ContainerOutlined />,
                element: Order,
                children: [
                    {
                        path: "order1",
                        name: "order1",
                        element: Orders1,
                        actived: true,
                    },
                    {
                        path: "order2",
                        name: "order2",
                        element: Orders2,
                        actived: true,
                    },
                    {
                        path: "order3",
                        name: "order3",
                        element: Orders3,
                        actived: true,
                    },
                ]
            },
            {
                path: "goods",
                name: "商品管理",
                icon: <ShoppingOutlined />,
                element: Goods1,
            }
 */